# Example: Bitwise operators

For these examples tag1 = 5 (binary 0000 0000 0000 0101), tag2 = 3 (binary 0000 0000 0000 0011)

tag1 & tag2
returns 1 (binary 0000 0000 0000 0001)

tag1 | tag2
returns 7 (binary 0000 0000 0000 0111)

tag1 ^ tag2
returns 6 (binary 0000 0000 0000 0110)

tag1 >> 1
returns 2 (binary 0000 0000 0000 0010)

tag1 << 1
returns 10 (binary 0000 0000 0000 1010)

~ tag1
returns -6 (binary 1111 1111 1111 1010)

## See also

About expressions

Bitwise operators in expressions